<style lang="less">
    @import '../../../styles/common.less';
    @import './less/calendar-test.less';
</style>
<template>
    <div>
            <Card>
                <p slot="title">
				    新增功能
			    </p>
                <div>
                    <Form class="step-form" ref="func" :model="func" :label-width="100">
                        <Row>
                            <i-col span="12">
                                <FormItem label="农历日期：" prop="lunar">
                                    <Input v-model="func.lunar" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入农历日期。如：19110819" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row>
                            <FormItem label="是否闰月：">
                                <template>
                                    <RadioGroup v-model="func.leapmonth">
                                        <Radio label="1">是</Radio>
                                        <Radio label="2">否</Radio>
                                    </RadioGroup>
                                </template>
                            </FormItem>
                        </Row>
                        <FormItem label="">
                            <Button @click="lunarSubmit" style="width:100px;" type="primary">提交</Button>
                        </FormItem>
                        <Row>
                            <i-col span="12">
                                <FormItem label="阳历日期：" prop="solar">
                                    <Input v-model="func.solar"  :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入阳历日期。如：19110819" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <FormItem label="">
                            <Button  @click="solarSubmit" style="width:100px;" type="primary">提交</Button>
                        </FormItem>
                    </Form>
                </div>
                <div>
                    <Input v-model="resultData"  disabled type="textarea" placeholder="数据结果"></Input>
                </div>
            </Card>
    </div>
</template>

<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'addrole',
    data () {
        return {
            func: {
                lunar: '19110625',
                solar: '19110819',
                leapmonth: '2'
            },
            resultData:"获取的数据结果"
        }
    },
    methods: {
        lunarSubmit () {
            let that = this
            let url = 'adminapi/test/lunar.html'
            let data = {
                lunar: that.func.lunar,
                leapmonth: that.func.leapmonth
            }
            ajax.formRes(url, data).then(res => {
                that.resultData = res
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        solarSubmit () {
            let that = this
            let url = 'adminapi/test/solar.html'
            
            let data = {
                solar: that.func.solar
            }
            ajax.formRes(url, data).then(res => {
                that.resultData = res
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        }
    }
}
</script>
